package com.mlog.njyjy.ndop.msg.common.domain;

import com.jfinal.plugin.activerecord.Model;
import com.mlog.njyjy.ndop.msg.common.support.Constants;
import com.mlog.njyjy.ndop.share.sql.annotation.Column;
import com.mlog.njyjy.ndop.share.sql.annotation.Id;
import com.mlog.njyjy.ndop.share.sql.annotation.Table;
import com.mlog.njyjy.ndop.share.sql.annotation.TableUnique;
import lombok.Data;
import lombok.experimental.Accessors;

import java.time.LocalDateTime;

/**
 * <p>
 * 保存数据有效期
 * </p>
 *
 * @author zyz
 * @version v1.0, 2020/8/6
 */
@Data
@Accessors(chain = true)
@Table(prefix = Constants.TBL_MSG_PREFIX, uniques = {@TableUnique(columns = {"dataId", "tableName", "dbName"})})
public class DataTTL extends Model<DataTTL> {
    @Id
    private Long id;

    @Column(nullable = false, comment = "数据id")
    private String dataId;

    @Column(nullable = false, comment = "表名")
    private String tableName;

    @Column(nullable = false, comment = "数据库名")
    private String dbName;

    /**
     * 创建时间
     */
    @Column(updatable = false)
    private LocalDateTime createAt;

    /**
     * 过期时间
     */
    @Column(nullable = false)
    private LocalDateTime expireAt;
}
